#!/bin/bash
sh check_expect.sh
passhare=$(cat /dev/urandom | head -20 | md5sum | awk '{print $1}'|cut -c 1-8)
echo $passhare
#read -p "please your username: " DNAME
#DNAME=$1
expect <<EOF 
set timeout 20
spawn docker run -v /home/openvpn/openvpn:/etc/openvpn --rm -it kylemanna/openvpn:2.4 easyrsa build-client-full $passhare nopass
expect "ca.key"
send "12345678\n"
expect eof
EOF

docker run -v /home/openvpn/openvpn:/etc/openvpn --rm kylemanna/openvpn:2.4 ovpn_getclient $passhare > /home/openvpn/openvpn/conf/$passhare.ovpn

